perm filename ARRAYS.DOC[SYS,BGB] blob sn#001400 filedate 1971-12-19 generic text, type T, neo UTF8
00100	            ARRAYS  -  SAIL MACROS FOR ARRAY ALLOCATION.
00200	
00300	                          Bruce g. Baumgart
00400	
00500	
00600		Slighlty  beneath  the  User level of SAIL, there are dynamic
00700	storage allocation routines.   The macros GETARY and RELARY call  the
00800	sail  routines  to  get  and  release  core  memory  space  for a one
00900	dimensional array of a desired size.
01000	
01100	GETARY(arrynam,size)....will allocate memory space to an array name.
01200	RELARY(arrynam).........will release the array's memory space.
01300	
01400	The arrays must initially be declared in an inner block or  as  small
01500	and  safe  so  that  SAIL  will  set  up  an array header and compile
01600	references to it. The arrays to be allocated are used  in  the  usual
01700	fashion: ARRYNAM[I].
01800	
01900	The require source file statement for declaring these macros is:
02000		REQUIRE "ARRAYS.HDR[DD,BGB]" SOURCE_FILE;
02100	
02200	The source file itself is merely:
02300		EXTERNAL PROCEDURE LRMAK (INTEGER LO,HI,ONE);
02400		EXTERNAL INTEGER   ARYEL;
02500	
02600		DEFINE GETARY(ARRY,SIZE) =
02700		"BEGIN	LRMAK(1,SIZE,1); QUICK_CODE MOVEM 1,ARRY;END;END";
02800	
02900		DEFINE RELARY(ARRY) =
03000		"QUICK_CODE PUSH 15,ARRY;PUSHJ 15,ARYEL;END";
03100	
03200	An example of a program using the ARRAYS macros is:
03300	BEGIN	"TEST"
03400		REQUIRE "ARRAYS.HDR" SOURCE_FILE;
03500	BEGIN	"INNER"
03600		SAFE INTEGER ARRAY TVBUF[1:2];
03700		SAFE REAL    ARRAY X[1:2];
03800		INTEGER I;
03900		GETARY(X,200);
04000		FOR I←2 STEP 1 UNTIL 200 DO X[I] ← 0.1234;
04100		RELARY(X);
04200		GETARY(TVBUF,10368);
04300		RELARY(TVBUF);
04400	END	"INNER"
04500	END	"TEST";
04600	
04700		If you don't understand why this is a good  thing,  then  you
04800	don't  need it and you shouldn't ask about it, it may be hazardous to
04900	the health of your core image.